using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Perovich.GameObjects.Controls.Shapes
{
    /// <summary>
    /// The <see cref="RectangleBase"/> class is an abstract base class implementing the common functionality of rectangles.
    /// </summary>
    public abstract class RectangleBase : Control
    {
        private Texture2D _lineTex;


        /// <summary>
        /// Gets or sets the texture used to draw the <see cref="RectangleBase"/>
        /// </summary>
        protected Texture2D LineTex
        {
            get { return _lineTex; }
            set { _lineTex = value; }
        }

        /// <summary>
        /// Constructs a new instance of the <see cref="RectangleBase"/> class.
        /// </summary>
        /// <param name="game"><see cref="Perovich.GameObjects.Interfaces.ICanHoldComponents"/> instance that this <see cref="DrawableComponent"/> will be constructed for.</param>
        protected RectangleBase(Interfaces.ICanHoldComponents game)
            : base(game)
        {
        }


        
        /// <summary>
        /// Allows the <see cref="RectangleBase"/> to draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of the game's timing values</param>
        public override void Draw(GameTime gameTime)
        {
            Vector2 P0 = Position;

            Vector2 delta = new Vector2(Width,Height);

            SBatches.CurrentBatch.Draw(_lineTex, new Microsoft.Xna.Framework.Rectangle((int)P0.X, (int)P0.Y, (int)delta.X, (int)delta.Y), null, ForegroundColor, 0, Vector2.Zero, SpriteEffects.None, Depth);
            base.Draw(gameTime);
        }
    }
}
